<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/view/common/tag.jsp" %>
<html style="background-color: #e2e2e2;">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>聊天机器人展览系统</title>
    <link rel="stylesheet" href="${baseurl}/lib/layui/css/layui.css">
    <link rel="stylesheet" href="${baseurl}/css/portal/global.css">
    <style>
        .header {
            border-bottom: 1px solid #404553;
            border-right: 1px solid #404553;
        }
    </style>
</head>
<body class="fly-full">
<jsp:include page="header.jsp"></jsp:include>
<div class="fly-main" style="overflow: hidden;">


    <ul class="fly-case-list" id="LAY_content">

    </ul>

    <div style="text-align: center;" id="LAY-page">
    </div>

</div>

<div class="fly-footer">
    <p>FUN 2021 &copy; FUN.com 出品</p>
</div>

<script id="gallery_tpl" type="text/html">
    {{# layui.each(d, function(index, item){ }}
    <li data-id="{{item.id}}">
        <a class="fly-case-img" href="${baseurl}/portal/exhibitionInfo?id={{item.id}}">
            <img src="{{item.galleryImage}}" alt="FUN">
            <cite class="layui-btn layui-btn-primary layui-btn-small">去围观</cite>
        </a>
        <h2><a href="${baseurl}/portal/exhibitionInfo?id={{item.id}}">{{item.galleryName}}</a></h2>
        <p class="fly-case-desc">{{item.gallerySummary}}</p>
    </li>
    {{# }); }}
    {{# if(d.length === 0){ }}
    暂无展览馆
    {{# } }}
</script>

<script type="text/javascript" src="${baseurl}/lib/layui/layui.js"></script>
<script type="text/javascript" src="${baseurl}/lib/layui_custom/Hlayui.js"></script>
<script>
    layui.use(['layer', 'laytpl', 'form','laypage','element'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var laytpl = layui.laytpl;
        var form = layui.form;
        var element = layui.element;
        var laypage = layui.laypage;

        (function() {
            $.get(BaseUrl+'portal/galleryInfo/list', {page: 1, limit: 10}, function (res) {
                renderList(res.data);
                var total = res.count;
                pageColumn(total);
            })
        })();

        /*列表渲染*/
        var renderList = function (data) {
            var getTpl = document.getElementById("gallery_tpl").innerHTML;
            laytpl(getTpl).render(data, function (html) {
                document.getElementById("LAY_content").innerHTML = html;
            });
        }
        /*分页插件渲染*/
        var pageColumn = function (total) {
            laypage.render({
                elem: 'LAY-page'
                , count: total
                , jump: function (obj, first) {
                    if (!first) {
                        getPage(obj.curr, obj.limit);
                    }
                }
            });
        };

        var getPage = function (page, limit) {
            $.get(BaseUrl+'portal/galleryInfo/list', {page: page, limit: limit}, function (res) {
                renderList(res.data);
            })
        }
    });
</script>
</body>
</html>
